package com.goldmantis.alitrip.service;

import com.goldmantis.alitrip.common.BaseService;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.internal.util.StringUtils;
import com.taobao.api.request.AlitripBtripApprovalNewRequest;
import com.taobao.api.request.AlitripBtripApprovalUpdateRequest;
import com.taobao.api.response.AlitripBtripApprovalNewResponse;
import com.taobao.api.response.AlitripBtripApprovalUpdateResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author:Shmily
 * @Description:
 * @Date:Create in 17:56 2018/1/15
 */
@Service
public class ApprovalUpdateService extends BaseService {

    @Autowired
    private  TaobaoClient client;

    /**
     * 更新审批列表
     * @param approveApplyRequest
     * @return
     * @throws Exception
     */
    public AlitripBtripApprovalUpdateResponse updateApproval(AlitripBtripApprovalUpdateRequest.OpenApproveApplyRq approveApplyRequest)  throws Exception {

        approveApplyRequest.setOperateTime(new Date());
        approveApplyRequest.setCorpId(corp_id);

        AlitripBtripApprovalUpdateRequest req = new AlitripBtripApprovalUpdateRequest();
        req.setApproveApplyRequest(approveApplyRequest);

        AlitripBtripApprovalUpdateResponse rsp = client.execute(req, accessToken);
        return rsp;
    }
}
